/**
 * @param {number} n
 * @param {number} k
 * @return {number[]}
 */
var circularGameLosers = function (n, k) {
  let arr = new Array(n).fill(0), res = []
  let start = 0, round = 1
  arr[start]++
  while (arr[start] < 2) {
    start = (start + round * k) % (n)
    round++
    arr[start]++
  }

  for (let i = 0; i < n; i++) {
    if (arr[i] == 0) {
      res.push(i+1)
    }
  }

  return res
};

circularGameLosers(2,1)